package com.salt.modules.sys.service;


import com.salt.database.datasource.annotation.DS;
import com.salt.modules.sys.entity.AuthUser;
import com.salt.modules.sys.mapper.AuthUserMapper;
import com.salt.modules.sys.utils.HttpHelper;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.CrossOrigin;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * (KpiUploadFiles)表服务实现类
 *
 * @author makejava
 * @since 2021-05-18 10:50:57
 */
@Service
@DS("doc")
@CrossOrigin
@Transactional(readOnly = false)
public class AuthUserService{
    @Resource
    private AuthUserMapper mapper;

    @Resource
    private Environment environment;


    /**
     * 分页数据
     *
     * @return 对象列表
     */
    public void insert(AuthUser user) {
        /*List<AuthUser> list = mapper.findList(user.getUsername());

        if(list == null || list.size() == 0){

            List<NameValuePair> parameters = new ArrayList<>();
            parameters.add(new BasicNameValuePair("username",user.getUsername()));
            parameters.add(new BasicNameValuePair("password",user.getPassword()));
            parameters.add(new BasicNameValuePair("email",user.getUsername() + "@sliios.com"));
            parameters.add(new BasicNameValuePair("first_name",user.getFirstName()));
            try {
                HttpHelper.httpPostFrom(environment.getProperty("salt.doc.url.register"), parameters);
            } catch (Exception e){
                e.printStackTrace();
            }
        }*/
    }
}